package com.pk.platform.business.data.web;

import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.business.data.service.IPackService;
import com.pk.platform.business.data.vo.PackVO;
import com.pk.platform.domain.data.Pack;
import com.pk.platform.util.StringConverter;

public class PackAction extends GenericAction {

	private IPackService packService;
	
	private Pack pack = new Pack();
	
	private PackVO packvo = new PackVO();
	
	public String packManage()
	{
		super.initGrid();
		return SUCCESS;
	}
	
	public String toSavePack()
	{
		if(StringConverter.isNotNull(pack.getId()))
		{
			pack = packService.queryPackById(pack.getId());
			pack.setPackBodyStr(StringConverter.blobToString(pack.getPackBody()));
		}
		return SUCCESS;
	}
	
	public String savePack()
	{
		pack.setPackBody(StringConverter.stringToBlob(pack.getPackBodyStr()));
		message = packService.savePack(pack);
		return SUCCESS;
	}
	
	public String delPack()
	{
		packService.delPack(pack.getId());
		return SUCCESS;
	}

	public IPackService getPackService() {
		return packService;
	}

	public void setPackService(IPackService packService) {
		this.packService = packService;
	}

	public Pack getPack() {
		return pack;
	}

	public void setPack(Pack pack) {
		this.pack = pack;
	}

	public PackVO getPackvo() {
		return packvo;
	}

	public void setPackvo(PackVO packvo) {
		this.packvo = packvo;
	}
	
}
